<?php // Connects to your Database 
$user=$_GET["usernamesignup"];
$email=$_GET["emailsignup"];
$pass=$_GET["passwordsignup"];
$name=$_GET["fullnamesigup"];
$brithday=$_GET["brithdaysigup"];

$conn = mysql_connect("localhost", "root","123456") or die("Ket noi den MySQL that bai");
mysql_select_db("mp3", $conn);	 	
$check = mysql_query("SELECT username FROM user WHERE username = "."'". $user."'")or die(mysql_error()); 
 	if(!$user | !$pass) 
    {
 		die('You did not fill in a required field.');
 	}
 	// checks it against the database
 
 	if (!get_magic_quotes_gpc()) 
    {
 		$email = addslashes($email);
 	}
 	$check = mysql_query("SELECT * FROM users WHERE username = '".$user."'")or die(mysql_error());
 
 //Gives error if user dosen't exist
 $check2 = mysql_num_rows($check);
 if ($check2 == 0) 
 {
	die('That user does not exist in our database. <a href=add.php>Click Here to Register</a>');
 }
 while($info = mysql_fetch_array( $check )) 	
 {
    $pass = stripslashes($pass);
 	$info['password'] = stripslashes($info['password']);
 	$pass = md5($pass);
 
 //gives error if the password is wrong
 	if ($pass != $info['password']) 
    {
 		die('Incorrect password, please try again.');
    }